
var mongoose = require('mongoose')
var db = require('./db.js')

var newsSchema = mongoose.Schema({
    title: String, //标题
    author: String, //作者
    date: String,   //发表时间
    content: String,
    project: String, //所属专题
    type: Array, //文章标签
    time: String, //阅读时间
    img: String, //文章封面
    read: Array //记录阅读数
});

// newsSchema.statics = {
//     fetch(name, cb) {
//         return this.find({'title': name})
//         .limit(5)
//         .skip(0)
//         .sort({'_id':-1})
//         .exec(cb);
//     }
// } 

var News = mongoose.model('news', newsSchema);

module.exports = News